package com.usian.controller;

import com.usian.feign.ContentFeign;
import com.usian.feign.ItemFeign;
import com.usian.pojo.TbItem;
import com.usian.pojo.TbItemDesc;
import com.usian.pojo.TbItemParamItem;
import com.usian.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("frontend/detail")
public class DetailWebController {
    @Autowired
    private ContentFeign contentFeign;
    @Autowired
    private ItemFeign itemFeign;
    @RequestMapping("selectItemInfo")
    public Result selectItemInfo(@RequestParam long itemId){
        TbItem item=itemFeign.selectItemInfo(itemId);
        if (item!=null){
            return Result.ok(item);
        }
        return Result.error("查询失败");

    }

    @RequestMapping("selectItemDescByItemId")
    public Result selectItemDescByItemId(@RequestParam long itemId){
        TbItemDesc tbItemDesc =itemFeign.selectItemDescByItemId(itemId);
        if (tbItemDesc!=null){
            return Result.ok(tbItemDesc);
        }
        return Result.error("查询失败");

    }

    @RequestMapping("selectTbItemParamItemByItemId")
    public Result selectTbItemParamItemByItemId(@RequestParam long itemId){
        TbItemParamItem tbItemParamItem =itemFeign.selectTbItemParamItemByItemId(itemId);
        if (tbItemParamItem!=null){
            return Result.ok(tbItemParamItem);
        }
        return Result.error("查询失败");

    }




}
